package cn.web.tunnelrobot.controller;

import cn.web.tunnelrobot.dto.WorkArea1;
import cn.web.tunnelrobot.pojo.Project;
import cn.web.tunnelrobot.pojo.WorkArea;
import cn.web.tunnelrobot.service.WorkAreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;
import java.util.HashMap;

/**
 * 标段-工区
 * @version 1.0.0
 *
 */
@RestController
@RequestMapping("/workArea")
public class WorkAreaController {
    @Autowired
    private WorkAreaService workAreaService;

    /**
     * 添加项目信息
     * @param workArea
     * @return
     */
    @PostMapping("/addWorkArea")
    @ResponseBody
    public HashMap<String,Object> addWorkArea(@RequestBody WorkArea1 workArea){
        return workAreaService.addWorkArea(workArea);
    }

    /**
     * 修改项目信息
     * @param workArea
     * @return
     */
    @PostMapping("/updateWorkArea")
    @ResponseBody
    public HashMap<String,Object> updateWorkArea(@RequestBody WorkArea1 workArea){
        return workAreaService.updateWorkArea(workArea);
    }

    /**
     * 查询标段工区信息列表
     * @param prId
     * @return
     */
    @GetMapping("/getWorkAreaList")
    @ResponseBody
    public HashMap<String,Object> getWorkAreaList(@RequestParam Integer prId){
        return workAreaService.getWorkAreaList(prId);
    }

    /**
     * 查询标段-工区id
     * @param waId
     * @return
     */
    @GetMapping("/getWorkAreaById")
    @ResponseBody
    public HashMap<String,Object> getWorkAreaById(@RequestParam Integer waId){
        return workAreaService.getWorkAreaByWaId(waId);
    }

    /**
     * 删除标段-waid
     * */
    @GetMapping("/deleteWorkAreaById")
    @ResponseBody
    public HashMap<String,Object> deleteWorkAreaById(@RequestParam Integer waId){
        return workAreaService.deleteWorkAreaByWaId(waId);
    }
}
